#!/usr/bin/env sh
set -ex
LINUX_DIR=`pwd`
BUSYBOX_DIR=${LINUX_DIR}/../busybox-1.11.1
# https://serverfault.com/questions/1082884/qemu-freezes-at-booting-from-hard-disk-with-nographic
qemu-system-i386 -m 512 -boot c\
	-kernel $LINUX_DIR/arch/i386/boot/bzImage \
  	-initrd $BUSYBOX_DIR/initrd_new.img.gz \
  	-append 'console=ttyS0,115200 root=/dev/ram init=sbin/init noapic'
#	-serial stdio
#

# -append "console=ttyS0,115200 root=/dev/ram rdinit=sbin/init noapic" \
# https://blog.csdn.net/kartorz/article/details/128137702
# -serial stdio: 把控制台重定向到当前终端，还可以这样来配置控制台:
# "console=ttyS0,115200 console=tty0" -serial file:kernel.log
# 使用虚拟机系统的终端，运行日志写到当前目录下的 kernel.log
